var reminderDateLabelArray = new Array(); // store the date label and delete date before we start deleting the reminders, as then the selected indices get shifted
var reminderDeleteDateArray = new Array();
for ( var i = 0; i < selectedReminders.length; i++ ) {
var currentReminder = selectedReminders[i];
var deleteDate = getInstanceDateOfLastSelected( currentReminder );
var dateLabel = reminderFox_getDateVariableString( currentReminder, deleteDate );
for ( i = lastIndex + 1; i < todos.length; i++ ) {
if ( todos[i].completedDate == null ) {
break;
}
}
return i;
}
function getPreviousTodoIndex(todos, lastIndex ) {
if ( !HIDE_COMPLETED_ITEMS ) {
return lastIndex - 1;
}
// bypass all completed todos
var i;
for ( i = lastIndex -1; i >= 0; i-- ) {
if ( todos[i].completedDate == null ) {
break;
}
}
return i;
}
function moveTodoDown() {
if ( !isLastTodoSelected( ) ) {
var oldIndices = getAllSelectedTodoIndices();
var todos = getCurrentTodoList();
var treeChildren = document.getElementById("todoTreechildren");
for ( var k = oldIndices.length -1; k >= 0; k-- ) {
var index = oldIndices[k];
var selectedTreeItem = treeChildren.childNodes[index];
var currentTodoRefId = selectedTreeItem.childNodes[0].getAttribute(REMINDER_ID_REF);
var currentTodo = reminderFox_getTodosById( currentTodoRefId, todos);
var nextIndex = index +1;
var nextselectedTreeItem = treeChildren.childNodes[nextIndex];
var todoRefId = nextselectedTreeItem.childNodes[0].getAttribute(REMINDER_ID_REF);
// get current index inside of todo array in memory
var i;
var found = false;
for ( i = 0; i < todos.length; i++ ) {
if ( todos[i].id == currentTodo.id ) {
found = true;
break;
}
}
if ( found ) {
//var newIndex = getNextTodoIndex(todos, i); // insert after old position (take into account some todos may be hidden as complete) // actually want index of next VISIBLE todo (use list todos, not memory todos?)
var newIndex = i + 1; // insert current selected item into the next index location (thus moving it down in the list)
var newTodo = reminderFox_cloneReminderFoxTodo( currentTodo );
var selectedTreeItemIndex = getTreeItemIndexForTodo( newTodo );